package com.martinwj.camera2demo.utils;

import android.content.Context;
import android.widget.Toast;

/**
 * author: wj
 * created on: 2021/6/10
 * description:
 */
public class ToastUtils {

    private static Context context = null;
    private static Toast toast = null;

    public static void showToast(Context context,String text) {
        if (toast == null) {
            toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
        } else {
            toast.cancel();
//            toast.setText(text);
            toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
//            toast.setDuration(Toast.LENGTH_SHORT);
        }
        toast.show();
    }
}
